﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LatestAdsProperty.ascx.cs" Inherits="NLUNZ.UserControls.LatestAdsProperty" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!--this control will
1. retrieve slideimages from database and display the list in gridview
2. enable edit/delete/insert
3. always sort the list by OrderNumber-->
<script type="text/javascript">
    $(document).ready(function () {
        $('#insertSlideshowSection').hide();
        $('#activeSlideshowSection').show();
        $('#inactiveSlideshowSection').hide();
        $('#insertSlideShowTab').click(function () {
            $('#insertSlideshowSection').toggle('slow');
        });
        $('#activeSlideshowTab').click(function () {
            $('#activeSlideshowSection').toggle('slow');
        });
        $('#inactiveSlideshowTab').click(function () {
            $('#inactiveSlideshowSection').toggle('slow');
        });
    });

</script>
<div class="property-box">
        <div>
        <div class="tabheaderContainer">
            <div id="insertSlideShowTab" class="tablinnerContainer">
            <a href="#" class="plainText">添加广告图片</a>
            </div>
                <div class="tabrefreshContainer">
        <asp:ImageButton ID="ImageButton3" runat="server"  onclick="LinkButton1_Click" 
            ImageUrl="~/Admin/Contents/Images/refresh.fw.png" />
        
    </div>
        </div>
        <div id="insertSlideshowSection">
        <div id="insertSlideShow" runat="server" style="padding: 10px 20px">
            <table cellspacing="0" cellpadding="0">
                <tr class="insert_evenrow"><td class="field-title">图片名字</td><td class="field-text">
                    <asp:TextBox ID="txtImageName" runat="server" Width="225px"></asp:TextBox></td></tr>
                <tr class="insert_evenrow"><td class="field-title">上传图片</td><td class="field-text">
                     <telerik:RadUpload ID="RadUpload1" runat="server" 
            TargetFolder="~/Images/Ads" OverwriteExistingFiles="False" 
                         AllowedFileExtensions=".jpg,.gif,.png,.bmp" MaxFileInputsCount="1" >
        </telerik:RadUpload>    
        <telerik:RadProgressArea ID="RadProgressArea1" runat="server">                
        </telerik:RadProgressArea>
                                                       </td></tr>
                <tr><td colspan="2" style="text-align: center; padding: 10px;">
    <asp:Button runat="server" ID="btnSubmit" CssClass="RadUploadSubmit" Text="Submit" 
            onclick="btnSubmit_Click" />

                    </td></tr>
            </table>
            <div id="showUploadMessage" runat="server">
                <asp:Literal runat="server" ID="showMessage"></asp:Literal>
            </div>
        </div>
        </div>
    </div>
    
    <div>
        <div style="height: 20px;"></div>
    <div class="tabheaderContainer">
        <div id="activeSlideshowTab" class="tablinnerContainer">
       <a href="#" class="plainText">Active Slideshow Images</a></div>
    <div class="tabrefreshContainer">
        <asp:ImageButton ID="ImageButton1" runat="server"  onclick="LinkButton1_Click" 
            ImageUrl="~/Admin/Contents/Images/refresh.fw.png" />
        
    </div>
    </div>
    <div style="padding: 20px 0;" id="activeSlideshowSection">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="Id" DataSourceID="LinqDataSourcLatestAdsEdit" 
        EnableModelValidation="True" AllowPaging="True" CellPadding="4" 
        ForeColor="#333333" GridLines="None" Width="100%">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:CommandField ShowEditButton="True" ButtonType="Image" 
                EditImageUrl="~/Images/edit-icon.gif" EditText="" 
                CancelImageUrl="~/Admin/Contents/Images/cancel-icon.gif" 
                UpdateImageUrl="~/Admin/Contents/Images/Update-icon.gif" >
            <ItemStyle Width="60px" />
            </asp:CommandField>
            <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
                <asp:TemplateField HeaderText="Image">
                    <ItemTemplate>
                        <img class="gridImage" src='<%= ResolveClientUrl("~/Images/Ads/") %><%#Eval("Content") %>' alt='<%#Eval("Title") %>' width="60px" height="60px"></img>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </asp:TemplateField>
                
            <asp:CommandField ShowDeleteButton="True" ButtonType="Image" 
                DeleteImageUrl="~/Images/delete-icon.gif" >
            <ItemStyle Width="50px" />
            </asp:CommandField>
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <EmptyDataTemplate>
            No Ads Images. Please Add in the insert form.
        </EmptyDataTemplate>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" Height="40px" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#CCCCCC" Font-Bold="True" ForeColor="#333333" />
    </asp:GridView>
    </div>
    <asp:LinqDataSource ID="LinqDataSourcLatestAdsEdit" 
        ContextTypeName="NLUNZ.Business.NLUDBDataContext" TableName="Banners" runat="server" 
        EnableDelete="True" EnableInsert="True" EnableUpdate="True" >
    </asp:LinqDataSource>
    </div>
    

</div>